﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SISLOG.BusinessLogic;
using Microsoft.Practices.Unity;

namespace SISLOG.Web
{
    public partial class frmCRUDArea : BasePage<frmCRUDArea>//System.Web.UI.Page
    {
        [Dependency]
        public IAreaBL AreaBL { get; set; }
               
                                
        protected void Page_Load(object sender, EventArgs e)
        {
                LabelTitulo.Text = "Editar Area"; 
                object obj = Request.QueryString["acc"];

                if (obj != null)
                {
                    if (obj.ToString() == "nuevo")
                    {
                        FormView1.ChangeMode(FormViewMode.Insert);
                        LabelTitulo.Text = "Registrar Area";
                    }
                }            
        }

        protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
        {
            Response.Redirect("frmArea.aspx");
        }

        protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
        {
            Response.Redirect("frmArea.aspx");
        }

        protected void ObjectDataSourceArea_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            e.ObjectInstance = AreaBL;
        }
    }
}